<!--
  
   BuildingEditor.xaml
  
   Copyright (c) 2007 Mike Strobel
  
   This source code is subject to the terms of the Microsoft Reciprocal License (Ms-RL).
   For details, see <http://www.opensource.org/licenses/ms-rl.html>.
  
   All other rights reserved.
  
  -->
<local:EditorBase x:Class="Supremacy.Editor.BuildingEditor"
             xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
             xmlns:s="clr-namespace:Supremacy.Client;assembly=SupremacyWPF"
             xmlns:local="clr-namespace:Supremacy.Editor"
             xmlns:tech="clr-namespace:Supremacy.Tech;assembly=SupremacyCore"
             xmlns:buildings="clr-namespace:Supremacy.Buildings;assembly=SupremacyCore"
             xmlns:econ="clr-namespace:Supremacy.Economy;assembly=SupremacyCore" 
             xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
             xmlns:scm="clr-namespace:System.ComponentModel;assembly=System" 
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  
  <local:EditorBase.Resources>
    <DataTemplate DataType="{x:Type econ:Bonus}">
      <TextBlock Text="{Binding Converter={StaticResource BonusDescriptionConverter}}"
                 TextTrimming="CharacterEllipsis"/>
    </DataTemplate>
  </local:EditorBase.Resources>
  
  <Grid Margin="12,0,0,12">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto"
                        SharedSizeGroup="EditorLeftColumnGroup" />
      <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>

    <Label Grid.Column="0"
           Grid.Row="0"
           Margin="0,3,2,3"
           Target="{Binding ElementName=EnergyCostText}"
           Content="Energy Cost:"
           FontWeight="Bold"/>
    <TextBox Name="EnergyCostText"
             Grid.Column="1"
             Grid.Row="0"
             Margin="2,3,2,3"
             Width="64"
             HorizontalAlignment="Left"
             Text="{Binding Path=EnergyCost}"/>

    
    <Label Grid.Column="0"
           Grid.Row="2"
           Margin="0,3,2,3"
           Target="{Binding ElementName=BonusList}"
           Content="Bonuses:"
           FontWeight="Bold"/>
    <DockPanel Grid.Column="1"
               Grid.Row="2"
               Margin="2,3,2,3"
               HorizontalAlignment="Left"
               LastChildFill="True">
      <ToolBarTray DockPanel.Dock="Right"
                   Orientation="Vertical"
                   IsLocked="True">
        <ToolBar>
          <Button Click="AddBonus">
            <Image Source="Resources/NewDocumentHS.png"
                   Width="16"
                   Height="16"/>
          </Button>
          <Button Click="DeleteBonus">
            <Image Source="Resources/DeleteHS.png"
                   Width="16"
                   Height="16"/>
          </Button>
        </ToolBar>
      </ToolBarTray>
      <ListView x:Name="BonusList"
                Width="320"
                Height="96"
                ItemsSource="{Binding Path=Bonuses}">
      </ListView>
    </DockPanel>
    

    <Label Grid.Column="0"
           Grid.Row="1"
           Margin="0,3,2,3"
           Target="{Binding ElementName=RestrictionsSelector}"
           Content="Restrictions:"
           FontWeight="Bold"/>
    <local:EnumFlagSelector x:Name="RestrictionsSelector"
                            Grid.Column="1"
                            Grid.Row="1"
                            Margin="2,3,2,3"
                            Height="96"
                            Width="256"
                            HorizontalAlignment="Left"
                            EnumType="{x:Type buildings:BuildRestriction}"
                            Value="{Binding Path=Restriction, Mode=TwoWay}" />
  </Grid>
</local:EditorBase>
